// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-9-29

#include "stdafx.h"
#include ".\utility.h"

void JoyLinearFillRectV(Graphics& graph, const Rect& r, const Color& c1, const Color& c2)
{
    GraphicsPath p;
    p.AddRectangle(Rect(r.X, r.Y, 1, r.Height));
    PathGradientBrush b(&p);
    b.SetCenterColor(c2);
    Color sColor[] = 
    {
        c1,
    };
    int sCount = 1;
    b.SetSurroundColors(sColor, &sCount);
    b.SetCenterPoint(Point(r.X, r.GetBottom()-1));
    b.SetFocusScales(1.0f, 0.0f);
    b.SetWrapMode(WrapModeTile);
    graph.FillRectangle(&b, r);
}

void JoyLinearFillRectV(Graphics& graph, const Rect& r, const Color* c, REAL* pos, int count)
{
    GraphicsPath p;
    p.AddRectangle(Rect(r.X, r.Y, 1, r.Height));
    PathGradientBrush b(&p);
    b.SetCenterColor(Color());
    Color sColor[] = 
    {
        Color(),
    };
    int sCount = 1;
    b.SetSurroundColors(sColor, &sCount);
    b.SetCenterPoint(Point(r.X, r.GetBottom()-1));
    b.SetFocusScales(1.0f, 0.0f);
    b.SetInterpolationColors(c, pos, count);
    b.SetWrapMode(WrapModeTile);
    graph.FillRectangle(&b, r);
}